﻿@model WeProjectsModel.Document

@{
    ViewBag.Title = "Delete";
    int usrId=int.Parse(Membership.GetUser().ProviderUserKey.ToString());
    if(Model.UploaderID!=usrId && !Roles.IsUserInRole("sysadmin"))
    {
        Response.Write("当前用户没有权限操作");
        Response.End();
    }
}

<h2>Delete</h2>
<br/>
文件信息：
<table class="gridtable">
    <tr><th>Name</th><th>Size</th><th>UploadTime</th></tr>
    <tr><td>@Html.DisplayFor(model => model.Name)</td>
    <td>@Html.DisplayFor(model => model.Size)</td>
    <td>@Html.DisplayFor(model => model.UploadDateTime)</td>
    </tr>    
</table>
<h3>
    @ViewBag.delMsg
</h3>
@if (ViewBag.delCode == 0)
{
    int rowNo = 0;
    <table class="gridtable">
        <tr><th></th><th>项目名称</th><th>任务描述</th></tr>
    @foreach(var item in Model.Tasks)
    {        
        <tr><td>@(++rowNo)</td><td>@Html.DisplayFor(modelItem => item.Project.Title)</td><td>@Html.DisplayFor(modelItem => item.Description)</td></tr>
    }
        </table>
}

@*<fieldset>
    <legend>Document</legend>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Name)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Name)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Size)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Size)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.UploadDateTime)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.UploadDateTime)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Member.Name)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Member.Name)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Project.Title)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Project.Title)
    </div>
</fieldset>*@
@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    <p>
        @if (ViewBag.delCode == 1) {
        <input type="submit" value="Delete" />
        }
        @Html.ActionLink("Back to List", "Index")
    </p>
}
